package cn.itcast.order;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.Locale;

/**
 * @author danDong
 * @date 2025-03-03 10:22:55
 */
public class DateTimeConversion {

    public String format(Date date1) {
        SimpleDateFormat inputFormatter = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy", Locale.ENGLISH);
        Date date = null;
        try {
            date = inputFormatter.parse(String.valueOf(date1));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        SimpleDateFormat outputFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 格式化Date对象为字符串
        String formattedDateTime = outputFormatter.format(date);
        return formattedDateTime;
    }
    public static void main(String[] args) {


        String dateStr = "Tue Dec 03 10:40:46 CST 2024"; //


    }
}
